package com.yzl.factory.simple;

import com.yzl.factory.AliPay;
import com.yzl.factory.Pay;
import com.yzl.factory.WechatPay;

/**
 * @program: design-pattern
 * @description: 简单工厂
 * @author: YaoZhiLi
 * @create: 2021-08-02 21:02
 */
public class SimplePayFactory {
    public static Pay createPay(String payType) {
        if (payType == null) {
            return null;
        }
        if (payType.equalsIgnoreCase("WECHAT PAY")) {
            return new WechatPay();
        }
        if (payType.equalsIgnoreCase("ALI PAY")) {
            return new AliPay();
        }
        return null;
    }
}